


#ifndef H_SCHED
#define H_SCHED

// The number of ticks to run, divided among processes, before re-scheduling ("x" from our "x/n" equation for time-sharing")
// #define RUN_TICKS 125

#define MAX_GROUPS 100


struct fs_sched_state {
	int total_cycles; // That we share among groups
	int current_cycle;
	int n_active_groups; // How many different groups are there in the ready q
	int group_ready_proc_counts[MAX_GROUPS]; // How many ready procs in each group
	int slice_group; // Size of a slice for a group (same for all groups)
};

struct sched_info {
	int group_no;				// What group does this process belong to
	int running_since; 	// A process is running since this clock tick.
};

// Forward-declarations
struct process;

// Scheduler function signatures.
void init_sched(void);
struct fs_sched_state *get_sched_state();
int add_ready_proc_to_group(struct process* p);
void remove_proc_from_ready_group(struct process* p);
void init_sched_info(struct sched_info* si);
void calculate_quantum_and_cycles_left(struct process* p, int *q, int *left);

int end_of_quantum();
int go();

#endif // H_SCHED
